#pragma once

//#ifndef STDIO_H
//#define STDIO_H
//#endif

#include "stdio.h"
#include <boost\algorithm\string.hpp>
#include <boost\graph\adjacency_list.hpp>
#include <boost\pending\disjoint_sets.hpp>
#include <vector>
#include <map>
#include <myEdge.h>
#include <myVertex.h>
#include <mySystem.h>

using namespace std;
using namespace boost;

class MwadjProcessor
{

public:
	
	MwadjProcessor(void);
	~MwadjProcessor(void);
	void processinput(string);

	void processTimeSortedData();

	template<typename edgeElement,typename ticktimeType, typename timestampType,typename chiValType,typename sbpType> 
	void processEdge(edgeElement,ticktimeType,timestampType,vector<chiValType>&,sbpType);

	template<typename vertexElement,typename ticktimeType,typename chiValType,typename timestampType,typename sbpType> 
	void processVertex(vertexElement,ticktimeType,timestampType,vector<chiValType>&,sbpType);

	template <typename sysFreqType,typename tickNoType,typename chiValType,typename timestampType,typename sbpType>
	void processSystem(sysFreqType,tickNoType,timestampType,vector<chiValType>&, sbpType&);

	template<typename vertexElement, typename disjointsetType> 
	void updateMST(vertexElement,vertexElement,disjointsetType&);

	template<typename myDataType> 
	int compareFunction(myDataType,myDataType);

	template<typename param1Type, typename param2Type>
	float calculate_sbp(param1Type, param2Type);

	template<typename param1Type, typename param2Type>
	float calc_edge_disc_wt(param1Type,param2Type);



private :

	int no_of_vertices;
	int no_of_edges;
	map<double,vector<string>> time_sorted_mwadj;

	typedef adjacency_list <vecS, vecS, undirectedS> Graph;
	//typedef graph_traits<Graph>::vertex_descriptor ipvertex;
	//typedef graph_traits<Graph>::vertices_size_type size_type;

	typedef int* Rank;
	typedef int* Parent;

	typedef disjoint_sets<Rank, Parent> mydisjointSet;

	Graph inputGraph;
	Graph MSTGraph;

	map<string,int> edge_id_mapping;
	map<int,int> vertex_id_mapping;
	map<int,myEdge> edge_properties;
	map<int,myVertex> vertex_properties;
	map<double,mySystem> system_properties;
	
public:
	
	void initialiseDisjointSets(mydisjointSet &);
};

